import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { NavBarComponent } from './nav-bar/nav-bar.component';
import { AppShareModule } from './app.share.module';
import { routingPages, routingPagesComponents, AppRoutingModule } from './app.router.module';
import { AuthGuard } from './providers/auth.guard';
import { AuthService } from './providers/auth.service';
import { HttpModule, Http, XHRBackend, RequestOptions } from '@angular/http';
import { InterceptedHttp } from './providers/http.interceptor';

import { ToastyService } from './modules/ng2-toasty';
import { Router } from "@angular/router";

@NgModule({
  declarations: [
    AppComponent,
    NavBarComponent,
    routingPages,
    routingPagesComponents
  ],
  imports: [
    BrowserModule,
    AppShareModule,
    AppRoutingModule
  ],
  providers: [
    AuthGuard,
    AuthService,
    {
      provide: Http,
      useFactory: (xhrBackend, requestOptions,router,toastyService) => {
        return new InterceptedHttp(xhrBackend, requestOptions,router,toastyService);
      },
      deps: [XHRBackend, RequestOptions,Router,ToastyService]
    }],
  bootstrap: [AppComponent]
})
export class AppModule { }
